#!/bin/env python

import os,zipfile,shutil

dirlist = [dir for dir in os.listdir(os.curdir) \
               if (os.path.isdir(dir) and dir[0] != '.')]
for dir in dirlist:
    f = zipfile.ZipFile(os.curdir + os.sep + dir + os.sep + dir + ".cwf", "w")
    for file in os.listdir(dir):
        if file[0] != '.' and file[-4:] != ".cwf" and file[-4:] != ".pyc":
            print os.curdir + os.sep + dir + os.sep + file
            f.write(os.curdir + os.sep + dir + os.sep + file, file)
    f.close()
    shutil.copyfile(os.curdir + os.sep + dir + os.sep + dir + ".cwf",
                    "../workflows/" + dir + ".cwf")
